package fun.mashuai.copy;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.file.FileAppender;
import cn.hutool.core.io.file.FileNameUtil;

import java.io.File;
import java.util.List;

/**
 * @author 马帅
 * @version 1.0
 * @description TODO
 * @className Test2.java
 * @date 2022/3/28 17:44
 */
public class Test2 {


    public static void main(String[] args) {

        String taskRecordPath = "D:\\dev-center\\map-data\\BingMapTest\\123" + File.separator + "taskRecord.txt";
        List<File> list = FileUtil.loopFiles("D:\\dev-center\\map-data\\BingMapTest\\123");
        // 任务记录文件
        File taskRecordFile = FileUtil.touch(taskRecordPath);

        FileAppender fileAppender = new FileAppender(taskRecordFile, 16, true);

        for (File file: list) {
            String name = FileNameUtil.getName(file);
            fileAppender.append(name.replace("zero", "tar").replace("txt", "tar"));
        }
        fileAppender.flush();

    }
}
